#include "../tools.h"

// https://blog.csdn.net/afei__/article/details/80638460

bool isPrime(int n){
    if(n <= 3) return n > 1;
    if(n % 6 != 1 && n % 6 != 5) return false;
    int bound = sqrt(n);
    for(int i = 5; i <= bound; i += 6){
        if(n % i == 0 || n % (i + 2) == 0) return false;
    }
    return true;
}

int main(int argc, char const *argv[])
{
    for(int i = 1; i <= 100; ++i){
        if(isPrime(i)) cout << i << " ";
    }
    cout << endl;

    return 0;
}
